<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\Storage;

/**
 * App\Models\SettingHomeInsurance
 *
 * @property int $id
 * @property string $img_url 封面图片
 * @property string $title 标题
 * @property string $subtitle 副标题
 * @property string $button_name 按钮的文字
 * @property string $url_set 链接设置
 * @property \Illuminate\Support\Carbon|null $created_at
 * @property \Illuminate\Support\Carbon|null $updated_at
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\SettingHomeInsurance newModelQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\SettingHomeInsurance newQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\SettingHomeInsurance query()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\SettingHomeInsurance whereButtonName($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\SettingHomeInsurance whereCreatedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\SettingHomeInsurance whereId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\SettingHomeInsurance whereImgUrl($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\SettingHomeInsurance whereSubtitle($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\SettingHomeInsurance whereTitle($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\SettingHomeInsurance whereUpdatedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\SettingHomeInsurance whereUrlSet($value)
 * @mixin \Eloquent
 */
class SettingHomeInsurance extends Model
{
    //
    protected $guarded = ['id'];

    public static function deleteImage($id,$update_img_url){
        $img_url = self::where('id',$id)->value('img_url');
        if($img_url != $update_img_url){
            $a = Storage::disk('oss')->delete($img_url);
        }
    }
}
